package com.zhoutao.blog.seven.api;

import com.zhoutao.blog.seven.model.Response;
import com.zhoutao.blog.seven.model.response.BLogCategory;
import com.zhoutao.blog.seven.service.CategoryService;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("/api/category")
public class CategoryController {

    private final CategoryService categoryService;

    public CategoryController(CategoryService categoryService) {
        this.categoryService = categoryService;
    }

    @GetMapping
    public Response<List<BLogCategory>> list() {
        List<BLogCategory> resp = categoryService.list();
        return Response.success(resp);
    }
}
